<?php

namespace App\Jobs;

use App\Http\Controllers\order\OrderThirdConfigController;
use App\Jobs\Middleware\SupplierDbConnectCheck;
use App\Models\Admin\Supplier;
use App\Models\Mysql\XnOrder;
use App\Models\Mysql\XnThirdGoods;
use App\Models\Mysql\XnThirdShop;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use mysql_xdevapi\Exception;

class SynChronousOrder implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    /**
     * Create a new job instance.
     */
    public function __construct(public $url,public $data){
    }


    /**
     * Execute the job.
     */
    public function handle(): void
    {
        try {
            httpClient()->post($this->url, $this->data);
        }catch (\Exception $e){
            Log::error('同步订单失败',[
                'url' => $this->url,
                'data' => $this->data,
                'message' => $e->getMessage(),
            ]);
        }

    }
}
